
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        span {
            display: inline-block;
            width: 160px;
            height: 40px;
            margin: 0 2px 5px;
            text-align: center;
            line-height: 40px;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        let div = document.querySelector("div")
        setInterval(() => {
            let r = Math.floor(Math.random() * 256),
                g = Math.floor(Math.random() * 256),
                b = Math.floor(Math.random() * 256)
            div.innerHTML += `<span style="background-color: rgb(${r}, ${g}, ${b});">rgb(${r}, ${g}, ${b})</span>`
            // console.log("111");
        }, 1000)

    </script>
</body>

</html>